﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VLUSM_DataAccess.Repositories
{
    public class StudentRepository : IDisposable
    {

        MainModelContainer context;

        public StudentRepository(MainModelContainer context)
        {
            this.context = context;
        }

        public SinhVien GetById(int id)
        {
            return context.SinhViens.Where(s => s.Id == id).FirstOrDefault();
        }

        public SinhVien[] GetAll()
        {
            throw new NotImplementedException();
        }

        public IQueryable<SinhVien> Query(System.Linq.Expressions.Expression<Func<SinhVien, bool>> filter)
        {
            return context.SinhViens.Where(filter);
        }

        #region IDisposable Members
        public void Dispose()
        {
            if (context != null)
            {
                context.Dispose();
            }
            GC.SuppressFinalize(this);
        }
        #endregion
    }
}
